#include "..\base\D3DUtil.h"
#include "..\base\SampleBase.h"
#include "..\base\Fps.h"

class FPSSample : public SampleBase
{
private:
	FPSDisplayer*    m_fps;
public:
	static const int k_Width = 640;
	static const int k_Height = 480;

	virtual bool Setup()
	{		
		m_fps = new FPSDisplayer(m_device);
		return true;
	}

	virtual void Cleanup()
	{
		d3dutil::Delete<FPSDisplayer*>(m_fps);
	}

	virtual bool Display(float timeDelta)
	{
		if (m_device)
		{
			m_device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0);
			m_device->BeginScene();

			m_fps->DrawFPSText(timeDelta);

			m_device->EndScene();
			m_device->Present(0, 0, 0, 0);
		}
		return true;
	}
};

SampleBase* g_CreateSample()
{
	return new FPSSample;
}